/*  header-comment
/*  file   : /Users/arida/react-hrm-h5/src/actions/steps/getFiles
/*  author : arida
/*  date   : 2017-6-4 18:27:47
/*  last   : 2017-8-4 17:38:10
*/
import { createAction } from "redux-actions";

import fetch from "../../utils/fetch.js";
import { get } from "../../utils/db";

export const getList = createAction("TODO_GETLIST");

export const fetchList = (date = new Date().format("yyyy-MM-dd")) => dispatch =>
  fetch(`/hrmregister/mobile/hrmSchedule/getScheduleList`, {
    body: {
      scheduleMonth: date,
      scheduleTypes: [3, 4, 5, 6]
    },
    meta: {
      dipId: -1
    }
  }).then(res => {
    if (res.success) {
      dispatch(getList(res.result));
    }
    return res;
  });
